package com.xhis.homenurse.tools;

import android.content.Context;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.xhis.homenurse.R;

/**
 * Created by 张兵 on 2019/7/16.
 */
public class DialogTools
{
    public static LinearLayout getDialgoTitleView(Context _c, String title, int drawable) {
        LinearLayout linearLayout = new LinearLayout(_c);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, DeviceInfo.dip2px(_c, 50));
        TextView titleView = new TextView(_c);
        titleView.setText(title);//内容
        //字体大小
        titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
        titleView.setPadding(DeviceInfo.dip2px(_c, 10), 0, 0, 0);
        //颜色
        titleView.setTextColor(_c.getResources().getColor(R.color.white));
        titleView.setBackgroundResource(drawable);
        titleView.setGravity(Gravity.CENTER | Gravity.LEFT);
        linearLayout.addView(titleView, params);
        return linearLayout;
    }
}
